function extract (svg) {
    var localtion = svg.contentDocument.getElementById("localtion");
    console.log("localtion : ",localtion);
    var polygonsPoints = getPolygonPoints(localtion.childNodes);
    console.log("polygons : ",polygonsPoints);
    return polygonsPoints;
}

function getPolygonPoints (nodes) {
    var result = new Object();
    for (let i=0;i<nodes.length;i++){
        var id = nodes[i].id;
        var value;
        var newId;

        if (id && typeof(id) != undefined) {
            var reg = RegExp(/-/);
            if (id.match(reg)) {
                var tt = id.split('-');
                newId = tt[0];
            } else {
                newId =id;
            }
            value = nodes[i].attributes.d.value;
            console.log("id : ",id);
            console.log("value :",value);
            var points = cvtToPoints(value);
            
            if (result.hasOwnProperty(id)){
                result[newId].push(value);
            } else {
                var array = new Array();
                result[newId] = array;
                result[newId].push(points);
            }
        }
    }
    return result;
}

function cvtToPoints (value) {
    var result = new Array();
    var tmp = value.split(' ');
    var reg = RegExp(/,/);
    for (let i=0;i<tmp.length;i++){        
        if (tmp[i].match(reg)) {
            var cood = tmp[i].split(',');
            var x = parseFloat(cood[0]);
            var y = parseFloat(cood[1]);
            result.push(x);
            result.push(y);
        }
    }
    // console.log(result);
    return result;
}